package gsp420;

import java.awt.BorderLayout;
import java.lang.reflect.Method;

import javax.swing.JApplet;
import javax.swing.JFrame;

// [applet.html]
//<!--
//How to make the Applet work using eclipse:
//* [Export] as [Java]->[Jar File]
//* name the jar file "HelloWorld.jar"
//* include that jar file in the same directory as this html file
//* run the HTML file.
//-->
//<APPLET ARCHIVE="HelloWorld.jar" CODE="gsp420.HelloWorld.class" WIDTH=90% HEIGHT=90%></APPLET>

public class HelloWorld extends JApplet
{
	public static void main(String[] args)
	{
		JFrame jf = new JFrame("my title");
		GamePanel gp = new GamePanel("hi world.");
		jf.add(gp);
		jf.addKeyListener(gp.getEventHandler());
		jf.setSize(800, 600);
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.setVisible(true);

		try
		{
			Class c = Class.forName("gsp420.GamePanel");
			Method m[] = c.getDeclaredMethods();
			for (int i = 0; i < m.length; i++)
				System.out.println(m[i].toString());
		} catch (Throwable e)
		{
			System.err.println(e);
		}
	}

	GamePanel gp;
	public HelloWorld()
	{
		gp = new GamePanel("I'm an Applet!");
		setLayout(new BorderLayout());
		add(gp, BorderLayout.CENTER);
		addKeyListener(gp.getEventHandler());
		gp.requestFocus();
	}
}
